#include "lexical.h"
#include "ui_lexical.h"

Lexical::Lexical(QWidget *parent)
    : QWidget(parent)
    , ui(new Ui::Lexical)
{
    ui->setupUi(this);
}

Lexical::~Lexical()
{
    delete ui;
}
void Lexical::addItem(QString name,QString type,QString id,QString row){
    QTableWidgetItem *item0 = new QTableWidgetItem(name);
    QTableWidgetItem *item1 = new QTableWidgetItem(type);
    QTableWidgetItem *item2 = new QTableWidgetItem(id);
    QTableWidgetItem *item3 = new QTableWidgetItem(row);
    int rowNum = ui->tableWidget->rowCount();
    ui->tableWidget->insertRow(rowNum);
    item0->setTextAlignment(Qt::AlignCenter);
    item1->setTextAlignment(Qt::AlignCenter);
    item2->setTextAlignment(Qt::AlignCenter);
    item3->setTextAlignment(Qt::AlignCenter);
    ui->tableWidget->setItem(rowNum,0,item0);
    ui->tableWidget->setItem(rowNum,1,item1);
    ui->tableWidget->setItem(rowNum,2,item2);
    ui->tableWidget->setItem(rowNum,3,item3);
}

void Lexical::addKeyItem(QString key,QString id){
    QTableWidgetItem *item0 = new QTableWidgetItem(key);
    QTableWidgetItem *item1 = new QTableWidgetItem(id);
    item0->setTextAlignment(Qt::AlignCenter);
    item1->setTextAlignment(Qt::AlignCenter);
    int rowNum = ui->tableWidget_2->rowCount();
    ui->tableWidget_2->insertRow(rowNum);
    ui->tableWidget_2->setItem(rowNum,0,item0);
    ui->tableWidget_2->setItem(rowNum,1,item1);
}


void Lexical::addHolographicSymbolItem(QString holographicSymbol,QString id){
    QTableWidgetItem *item0 = new QTableWidgetItem(holographicSymbol);
    QTableWidgetItem *item1 = new QTableWidgetItem(id);
    item0->setTextAlignment(Qt::AlignCenter);
    item1->setTextAlignment(Qt::AlignCenter);
    int rowNum = ui->tableWidget_3->rowCount();
    ui->tableWidget_3->insertRow(rowNum);
    ui->tableWidget_3->setItem(rowNum,0,item0);
    ui->tableWidget_3->setItem(rowNum,1,item1);
}
